<?php $this->layout( 'layout', [
	'body_class' => 'search-page',
	'info' => $info,
	'config' => $config,
] ) ?>

<?php if ( ! $error ) : ?>

<h2 class="page-heading">Search for &quot;<?=$this->e( @$_GET['q'] )?>&quot;</h2>

<?php if ( count( $entries > 0 ) ) : ?>

<div class="entries thumbnails">
<?php foreach( $entries as $entry ) : ?>
	<?php if ( $entry['item_type'] == 'video' ) : ?>
	<div class="entry video">
		<a title="<?=$this->e( $entry['description'] )?>" href="<?=$this->e( $entry['video_url'] )?>">
			<img src="<?=$this->e( $entry['thumbnail_url'] )?>" />
		</a>
		<p class="title">
			<a title="<?=$this->e( $entry['description'] )?>" href="<?=$this->e( $entry['video_url'] )?>"><?=$this->e( $entry['title'] )?></a>
		</p>
		<p class="author"><a href="<?=$this->e( $entry['author_url'] )?>"><?=$this->e( $entry['author_name'] )?></a></p>
		</a>
	</div>
	<?php elseif ( $entry['item_type'] == 'channel' ) : ?>
	<div class="entry channel">
		<a href="<?=$this->e( $entry['channel_url'] )?>">
			<img src="<?=$this->e( $entry['channel_thumbnail_url'] )?>" />
		</a>
		<p class="author">
			<a href="<?=$this->e( $entry['channel_url'] )?>"><?=$this->e( $entry['channel_name'] )?></a>
		</p>
		<p class="sub-count"><?=$this->e( $entry['subscriber_count'] )?></p>
		<p class="video-count"><?=$this->e( $entry['video_count'] )?> publishes</p>
	</div>
	<?php endif; ?>
<?php endforeach; ?>
</div>

<div class="page-navigation">
	<div class="left element">
		<?php if ( $info['previous_page_url'] ) : ?>
		<a href="<?=$this->e( $info['previous_page_url'] )?>">&laquo; Previous page</a>
		<?php endif; ?>
	</div>
	<div class="right element">
		<?php if ( $info['next_page_url'] ) : ?>
		<a href="<?=$this->e( $info['next_page_url'] )?>">Next page &raquo;</a>
		<?php endif; ?>
	</div>
</div>

<?php endif; ?>

<?php else : ?>

<div class="error msg">Error: <?=$this->e($error)?></div>

<?php endif; ?>
